/*
 * @lc app=leetcode id=771 lang=cpp
 *
 * [771] Jewels and Stones
 */
class Solution {
public:
    int numJewelsInStones(string J, string S) {

        if (J.size() < 1 || S.size() < 1) {
            return 0;
        }

        int num = 0;
        map<char, bool> memo;
        for (auto j : J) {
            memo[j] = true;
        }

        for (auto s : S) {
            if (memo[s]) {
                num++;
            }
        }

        return num;
    }
};

